package com.lznb.cloud.controller.frant;

import com.lznb.cloud.entity.News;
import com.lznb.cloud.service.NewsCategoryService;
import com.lznb.cloud.service.NewsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * Created by Administrator on 2018/8/6.
 */
@Controller
@RequestMapping("/f/IndexController")
public class FIndexController {

    @Autowired
    private NewsService newsService;

    @RequestMapping("/toIndex")
    public String toIndex(Model model) {
        List<News> page2 = newsService.findByCategory("01564e224fec4f2db9c9a9f7137d5adb");
        List<News> page3 = newsService.findByCategory("b3e391f73a2248348998dc96f8d393ef");
        List<News> page4 = newsService.findByCategory("0eb26db1efa4431e99cadf0f21c3ed77");
        model.addAttribute("page2",page2);
        model.addAttribute("page3",page3);
        model.addAttribute("page4",page4);
        return "/frant/index";
    }

    /**
     * 关于我们
     * @return
     */
    @RequestMapping("toAbout")
    public String toAbout(){
        return "/frant/about";
    }

    /**
     * 新闻资讯
     * @return
     */
    @RequestMapping("toNews")
    public String toNews(){
        return "/frant/news";
    }
    /**
     * 项目案例
     * @return
     */
    @RequestMapping("toCase")
    public String toCase(Model model){
        List<News> page3 = newsService.findByCategory("b3e391f73a2248348998dc96f8d393ef");
        model.addAttribute("page3",page3);
        return "/frant/case";
    }
    /**
     * 常见问题
     * @return
     */
    @RequestMapping("toWenti")
    public String toWenti(){
        return "/frant/wenti";
    }
    /**
     * 联系我们
     * @return
     */
    @RequestMapping("toContact")
    public String toContact(){
        return "/frant/contact";
    }
    /**
     * 项目展示
     * @return
     */
    @RequestMapping("toCaseshow")
    public String toCaseshow(){
        return  "/frant/Caseshow";
    }
}
